﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace CCRPlanner {

    public partial class AddSession : Window {

        public String SelectedSessionName { get; set; }

        public AddSession(IEnumerable<SessionStats> sessions) {
            InitializeComponent();

            foreach (var s in sessions) {
                cbSessions.Items.Add(s.SessionName);
            }

            SelectedSessionName = null;

            if (cbSessions.Items.Count > 0)
                cbSessions.SelectedIndex = 0;
        }

        private void Cancel_Click(object sender, RoutedEventArgs e) {
            this.Close();
        }

        private void Save_Click(object sender, RoutedEventArgs e) {
            if(cbSessions.SelectedIndex >= 0)
                SelectedSessionName = cbSessions.SelectedItem.ToString();
            this.Close();
        }
    }
}
